Type-Based Methods for Termination and Productivity in Coq

نویسندگان

  • Bruno Barras
  • Jorge Luis Sacchini
چکیده

Coq is a total dependently-typed programming language: recursive functions must be terminating and co-recursive functions must be productive. The requirement of totality is essential to ensure logical consistency, since a non-terminating function can be easily used to encode a proof of falsity. Systems based on dependent type theories, such as Coq and Agda, typically use syntactic methods, called guard predicates in Coq, to ensure termination (and productivity). A guard predicate is a form of static analysis, performed on the body of recursive functions, that checks that recursive functions are placed on structurally smaller arguments. Guard predicates were initially implemented in Coq over 15 years ago by Eduardo Giménez. Throughout the years, the guard predicate implementation has been relaxed and extended, in order to accept more recursion patterns as terminating (the most recent addition involves commutative cuts [6]). As a result, the implementation is large and difficult to maintain, making the termination checker one of the weakest point in the Coq kernel. This is highly undesirable, since any bug at this level jeopardizes logical consistency. Furthermore, the metatheoretical properties of the implemented extensions have not been studied (in particular, logical consistency). From the user point of view, the limitations of syntactic-based termination appear often in practice. Let us illustrate with a typical example. Consider the following definitions of subtraction and division on natural numbers, where divx y computes d x y+1e by repeated subtraction:

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Well-Founded Sized Types in the Calculus of (Co)Inductive Constructions

Type-based termination is a mechanism for ensuring termination and productivity of (co)recursive definitions [4]. Its main feature is the use of sized types (i.e. types annotated with size information) to track the size of arguments in (co)recursive calls. Termination of recursive function (and productivity of corecursive functions) is ensured by restricting recursive calls to smaller arguments...

متن کامل

A Unifying Approach to Recursive and Co-recursive Definitions

In type theory based logical frameworks, recursive and corecursive definitions are subject to syntactic restrictions that ensure their termination and productivity. These restrictions however greately decrease the expressive power of the language. In this work we propose a general approach for systematically defining fixed points for a broad class of well given recursive definition. This approa...

متن کامل

On type-based termination and dependent pattern matching in the calculus of inductive constructions. (Terminaison basée sur les types et filtrage dépendant pour le calcul des constructions inductives)

Proof assistants based on dependent type theory are progressively used as a tool to develop certified programs. A successful example is the Coq proof assistant, an implementation of a dependent type theory called the Calculus of Inductive Constructions (CIC). Coq is a functional programming language with an expressive type system that allows to specify and prove properties of programs in a high...

متن کامل

Recursion on Nested Datatypes in Dependent Type Theory

Nested datatypes are families of datatypes that are indexed over all types and where the datatype constructors relate different members of the family. This may be used to represent variable binding or to maintain certain invariants through typing. In dependent type theory, a major concern is the termination of all expressible programs, so that types that depend on object terms can still be type...

متن کامل

Stop When You Are Almost-Full - Adventures in Constructive Termination

Disjunctive well-foundedness, size-change termination, and well-quasi-orders are examples of techniques that have been successfully applied to program termination. Although these works originate in different communities, they rely on closely related principles and both employ similar arguments from Ramsey theory. At the same time there is a notable absence of these techniques in programming sys...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2013